package cn.xny.controller;

import cn.xny.dto.CourseParamsDto;
import cn.xny.service.ISearchService;
import cn.xny.txcc.dto.CourseEsDto;
import cn.xny.txcc.result.JSONResult;


import cn.xny.txcc.result.PageList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/search")
public class SearchController {
    @Autowired
    private ISearchService searchService;

    @PostMapping("/save")
    public JSONResult save(@RequestBody CourseEsDto courseEsDto){
        searchService.save(courseEsDto);
        return JSONResult.success();
    }

    @PostMapping("/course")
    public JSONResult course(@RequestBody CourseParamsDto courseParamsDto){

        PageList<CourseEsDto> pageListe = searchService.searchCourse(courseParamsDto);
        return JSONResult.success(pageListe);

    }


}